package pl.ajasinski.unittest;


import static org.junit.Assert.assertEquals;
import static org.junit.Assert.fail;

import java.util.NoSuchElementException;
import java.util.concurrent.TimeUnit;

import org.junit.After;
import org.junit.Before;
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.WebDriverWait;

	

public class Page {
	public static String Base_URL = "http://demo.bananascrum.com";
	protected WebDriver  driver;
	protected WebDriverWait wait;
	
	public StringBuffer verificationErrors = new StringBuffer();

	public Page(WebDriver driver) {
		// TODO Auto-generated constructor stub
	}

	public void asert(String nazwa, By nazwa2) {
		assertEquals(nazwa, driver.findElement(nazwa2).getText());
	}

	public void click(By linkText) {
		driver.findElement(linkText).click();
	}

	public void insertTekst(By by, String tekst) {
		driver.findElement(by).clear();
		driver.findElement(by).sendKeys(tekst);
	}

	public boolean isElementPresent(By by) {
		try {
			driver.findElement(by);
			return true;
		} catch (NoSuchElementException e) {
			return false;
		}
	}
}
